﻿// ***********************************************************************
// Assembly         : SgResearch.Core
// Author           : Jean-Francois LEQUEUX
// Created          : 04-13-2013
//
// Last Modified By : Jean-Francois LEQUEUX
// Last Modified On : 04-13-2013
// ***********************************************************************
// <copyright file="DisplaySizeAttribute.cs" company="SGCIB">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary>Display size attribute for editor</summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;

namespace MvcToolbox
{
    /// <summary>
    /// Class DisplaySize
    /// </summary>
    public class DisplaySizeAttribute : Attribute
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DisplaySizeAttribute" /> class.
        /// </summary>
        /// <param name="sizeForLabel">The size for label.</param>
        /// <param name="sizeForEdit">The size for edit.</param>
        /// <param name="sizeForLine">The size for line.</param>
        public DisplaySizeAttribute(EnumSize sizeForLabel = EnumSize.Size_4_8, EnumSize sizeForEdit = EnumSize.Size_4_8, EnumSize sizeForLine = EnumSize.Size_8_8)
        {
            this.SizeForLabel = sizeForLabel.ToDescription();
            this.SizeForEdit = sizeForEdit.ToDescription();
            this.SizeForLine = sizeForLine.ToDescription();
        }

        /// <summary>
        /// Enumeration size
        /// </summary>
        public enum EnumSize
        {
            /// <summary>
            /// The size_1_8
            /// </summary>
            [Description("s_1_8")]
            Size_1_8,

            /// <summary>
            /// The size_2_8
            /// </summary>
            [Description("s_2_8")]
            Size_2_8,

            /// <summary>
            /// The size_3_8
            /// </summary>
            [Description("s_3_8")]
            Size_3_8,

            /// <summary>
            /// The size_4_8
            /// </summary>
            [Description("s_4_8")]
            Size_4_8,

            /// <summary>
            /// The size_5_8
            /// </summary>
            [Description("s_5_8")]
            Size_5_8,

            /// <summary>
            /// The size_6_8
            /// </summary>
            [Description("s_6_8")]
            Size_6_8,

            /// <summary>
            /// The size_7_8
            /// </summary>
            [Description("s_7_8")]
            Size_7_8,

            /// <summary>
            /// The size_8_8
            /// </summary>
            [Description("s_8_8")]
            Size_8_8,
        }

        /// <summary>
        /// Gets or sets the size for label.
        /// </summary>
        /// <value>The size for label.</value>
        public string SizeForLabel { get; set; }

        /// <summary>
        /// Gets or sets the size for edit.
        /// </summary>
        /// <value>The size for edit.</value>
        public string SizeForEdit { get; set; }

        /// <summary>
        /// Gets or sets the size for line.
        /// </summary>
        /// <value>The size for line.</value>
        public string SizeForLine { get; set; }
    }
}